package gui;
/**
 * Draws the graphical UI elements for the main login screen, as well as the
 * registration menu and all lost-password functionality. 
 */
import java.util.Set;

import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.JList;
import javax.swing.DefaultListModel;
import javax.swing.AbstractListModel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;

import server.networking.ServerRemote;

import org.eclipse.wb.swing.FocusTraversalOnArray;

public class GUI extends JFrame {
	private JTextField textField;
	private JPasswordField passwordField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_6;
	private JTextField textField_7;
	private JTextField textField_8;
	private JPasswordField passwordField_1;
	private JTextField textField_5;
	private JPasswordField passwordField_2;
	private JPasswordField passwordField_3;
	private JTextField textField_9;
	private JTextField textField_10;
	private JTextField textField_11;
	private JTextField textField_12;
	private JTextField textField_13;
	
	private Set<Integer> ids;
	private DefaultListModel listModel;
	private String[] tableIDs;
	private int numTables;
	private ServerRemote sr;
	
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					GUI frame = new GUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
	
	/**
	 * Create the frame.
	 */
	@SuppressWarnings("unchecked")
	public GUI() {
		super("HAIBO ZENG");
		
		setBackground(Color.WHITE);
		getContentPane().setBackground(Color.BLACK);
		getContentPane().setLayout(new CardLayout(0, 0));
		
		JPanel LOGIN = new JPanel();
		LOGIN.setBackground(Color.BLACK);
		getContentPane().add(LOGIN, "");
		LOGIN.setLayout(null);
		
		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.setBounds(64, 11, 500, 244);
		LOGIN.add(lblNewLabel);
		lblNewLabel.setIcon(new ImageIcon(GUI.class.getResource("/images/login_title.jpg")));
		lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
		
		JLabel lblUsername = new JLabel("Username:");
		lblUsername.setBounds(202, 292, 51, 15);
		lblUsername.setHorizontalAlignment(SwingConstants.RIGHT);
		LOGIN.add(lblUsername);
		lblUsername.setFont(new Font("Candara", Font.BOLD, 11));
		lblUsername.setForeground(Color.WHITE);
		lblUsername.setLabelFor(textField);
		
		textField = new JTextField();
		textField.setBounds(268, 290, 175, 20);
		LOGIN.add(textField);
		textField.setColumns(10);
		
		JLabel lblPassword = new JLabel("Password:");
		lblPassword.setBounds(188, 319, 80, 15);
		lblPassword.setHorizontalAlignment(SwingConstants.CENTER);
		LOGIN.add(lblPassword);
		lblPassword.setForeground(Color.WHITE);
		lblPassword.setFont(new Font("Candara", Font.BOLD, 11));
		
		passwordField = new JPasswordField();
		passwordField.setBounds(268, 317, 175, 20);
		LOGIN.add(passwordField);
		
		JButton btnNewButton = new JButton("Login");
		btnNewButton.setBounds(268, 344, 85, 23);
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CardLayout cl = (CardLayout)(getContentPane().getLayout());
		        cl.next(getContentPane());
		        cl.next(getContentPane());
			}
		});
		LOGIN.add(btnNewButton);
		
		JButton btnRegister = new JButton("Register");
		btnRegister.setBounds(358, 344, 85, 23);
		LOGIN.add(btnRegister);
		
		JPanel REGISTRATION = new JPanel();
		REGISTRATION.setBackground(Color.BLACK);
		getContentPane().add(REGISTRATION, "");
		REGISTRATION.setLayout(null);
		
		JLabel lblNewLabel_1 = new JLabel("");
		lblNewLabel_1.setBounds(77, 7, 737, 100);
		lblNewLabel_1.setIcon(new ImageIcon(GUI.class.getResource("/images/registration_title.jpg")));
		REGISTRATION.add(lblNewLabel_1);
		
		JLabel lblFieldsMarkedBy = new JLabel("Fields marked by an asterisk are required.");
		lblFieldsMarkedBy.setBounds(252, 114, 391, 14);
		lblFieldsMarkedBy.setFont(new Font("SansSerif", Font.PLAIN, 10));
		lblFieldsMarkedBy.setForeground(Color.WHITE);
		REGISTRATION.add(lblFieldsMarkedBy);
		
		Component rigidArea_4 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_4.setBounds(57, 142, 20, 20);
		REGISTRATION.add(rigidArea_4);
		
		Component rigidArea_3 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_3.setBounds(77, 142, 20, 20);
		REGISTRATION.add(rigidArea_3);
		
		Component horizontalStrut_17 = Box.createHorizontalStrut(20);
		horizontalStrut_17.setBounds(97, 152, 20, 12);
		REGISTRATION.add(horizontalStrut_17);
		
		Component horizontalStrut_16 = Box.createHorizontalStrut(20);
		horizontalStrut_16.setBounds(117, 152, 20, 12);
		REGISTRATION.add(horizontalStrut_16);
		
		Component horizontalStrut_15 = Box.createHorizontalStrut(20);
		horizontalStrut_15.setBounds(137, 152, 20, 12);
		REGISTRATION.add(horizontalStrut_15);
		
		Component horizontalStrut_14 = Box.createHorizontalStrut(20);
		horizontalStrut_14.setBounds(157, 152, 20, 12);
		REGISTRATION.add(horizontalStrut_14);
		
		JLabel lblFirstName = new JLabel("First Name");
		lblFirstName.setBounds(177, 144, 61, 16);
		lblFirstName.setHorizontalAlignment(SwingConstants.RIGHT);
		lblFirstName.setForeground(Color.WHITE);
		REGISTRATION.add(lblFirstName);
		
		JLabel label = new JLabel("*   ");
		label.setBounds(238, 144, 14, 16);
		label.setForeground(Color.RED);
		REGISTRATION.add(label);
		
		textField_1 = new JTextField();
		textField_1.setBounds(252, 138, 180, 28);
		lblFirstName.setLabelFor(textField_1);
		REGISTRATION.add(textField_1);
		textField_1.setColumns(10);
		
		Component rigidArea_10 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_10.setBounds(469, 142, 20, 20);
		REGISTRATION.add(rigidArea_10);
		
		Component rigidArea_11 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_11.setBounds(496, 142, 20, 20);
		REGISTRATION.add(rigidArea_11);
		
		Component rigidArea_1 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_1.setBounds(523, 142, 20, 20);
		REGISTRATION.add(rigidArea_1);
		
		Component rigidArea_7 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_7.setBounds(543, 142, 20, 20);
		REGISTRATION.add(rigidArea_7);
		
		Component rigidArea_8 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_8.setBounds(563, 142, 20, 20);
		REGISTRATION.add(rigidArea_8);
		
		Component rigidArea_9 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_9.setBounds(583, 142, 20, 20);
		REGISTRATION.add(rigidArea_9);
		
		Component rigidArea_12 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_12.setBounds(603, 142, 20, 20);
		REGISTRATION.add(rigidArea_12);
		
		Component rigidArea_13 = Box.createRigidArea(new Dimension(20, 20));
		rigidArea_13.setBounds(623, 142, 20, 20);
		REGISTRATION.add(rigidArea_13);
		
		JLabel lblLastName = new JLabel("Last Name");
		lblLastName.setBounds(177, 179, 61, 16);
		lblLastName.setHorizontalAlignment(SwingConstants.RIGHT);
		lblLastName.setForeground(Color.WHITE);
		REGISTRATION.add(lblLastName);
		
		JLabel label_1 = new JLabel("*   ");
		label_1.setBounds(238, 179, 14, 16);
		label_1.setForeground(Color.RED);
		REGISTRATION.add(label_1);
		
		textField_2 = new JTextField();
		textField_2.setBounds(252, 173, 180, 28);
		lblLastName.setLabelFor(textField_2);
		textField_2.setColumns(10);
		REGISTRATION.add(textField_2);
		
		JLabel lblUsername_1 = new JLabel("Username");
		lblUsername_1.setBounds(177, 214, 61, 16);
		lblUsername_1.setHorizontalAlignment(SwingConstants.RIGHT);
		lblUsername_1.setForeground(Color.WHITE);
		REGISTRATION.add(lblUsername_1);
		
		JLabel label_2 = new JLabel("*   ");
		label_2.setBounds(238, 214, 14, 16);
		label_2.setForeground(Color.RED);
		REGISTRATION.add(label_2);
		
		textField_3 = new JTextField();
		textField_3.setBounds(252, 208, 180, 28);
		textField_3.setColumns(10);
		REGISTRATION.add(textField_3);
		
		JLabel lblEmail = new JLabel("Email");
		lblEmail.setBounds(177, 249, 61, 16);
		lblEmail.setHorizontalAlignment(SwingConstants.RIGHT);
		lblEmail.setForeground(Color.WHITE);
		REGISTRATION.add(lblEmail);
		
		JLabel label_3 = new JLabel("*   ");
		label_3.setBounds(238, 249, 14, 16);
		label_3.setForeground(Color.RED);
		REGISTRATION.add(label_3);
		
		textField_4 = new JTextField();
		textField_4.setBounds(252, 243, 180, 28);
		textField_4.setColumns(10);
		REGISTRATION.add(textField_4);
		
		JLabel lblPassword_1 = new JLabel("Password");
		lblPassword_1.setBounds(177, 284, 61, 16);
		lblPassword_1.setHorizontalAlignment(SwingConstants.RIGHT);
		lblPassword_1.setForeground(Color.WHITE);
		REGISTRATION.add(lblPassword_1);
		
		JLabel label_4 = new JLabel("*   ");
		label_4.setBounds(238, 284, 14, 16);
		label_4.setForeground(Color.RED);
		REGISTRATION.add(label_4);
		
		passwordField_1 = new JPasswordField();
		passwordField_1.setBounds(252, 278, 180, 28);
		REGISTRATION.add(passwordField_1);
		
		JLabel lblAge = new JLabel("Age");
		lblAge.setBounds(177, 319, 61, 16);
		lblAge.setHorizontalAlignment(SwingConstants.RIGHT);
		lblAge.setForeground(Color.WHITE);
		REGISTRATION.add(lblAge);
		
		textField_6 = new JTextField();
		textField_6.setBounds(252, 313, 180, 28);
		textField_6.setColumns(10);
		REGISTRATION.add(textField_6);
		
		JLabel lblGender = new JLabel("Gender");
		lblGender.setBounds(177, 354, 61, 16);
		lblGender.setHorizontalAlignment(SwingConstants.RIGHT);
		lblGender.setForeground(Color.WHITE);
		REGISTRATION.add(lblGender);
		
		textField_7 = new JTextField();
		textField_7.setBounds(252, 348, 180, 28);
		textField_7.setColumns(10);
		REGISTRATION.add(textField_7);
		
		JLabel lblLocation = new JLabel("Location");
		lblLocation.setBounds(177, 389, 61, 16);
		lblLocation.setHorizontalAlignment(SwingConstants.RIGHT);
		lblLocation.setForeground(Color.WHITE);
		REGISTRATION.add(lblLocation);
		
		textField_8 = new JTextField();
		textField_8.setBounds(252, 383, 180, 28);
		textField_8.setColumns(10);
		REGISTRATION.add(textField_8);
		
		JButton button = new JButton("Confirm");
		button.setBounds(252, 424, 85, 28);
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CardLayout cl = (CardLayout)(getContentPane().getLayout());
		        cl.next(getContentPane());		//go to main menu
			}
		});
		REGISTRATION.add(button);
		
		JButton btnCancel = new JButton("Cancel");
		btnCancel.setBounds(347, 424, 85, 28);
		btnCancel.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CardLayout cl = (CardLayout)(getContentPane().getLayout());
		        cl.first(getContentPane());		//go back to login
			}
		});
		REGISTRATION.add(btnCancel);
		
		JPanel MAINMENU = new JPanel();
		MAINMENU.setBorder(null);
		MAINMENU.setBackground(Color.BLACK);
		getContentPane().add(MAINMENU, "");
		MAINMENU.setLayout(null);
		
		final JPanel LOGOUTCONFIRM = new JPanel();
		LOGOUTCONFIRM.setBackground(Color.DARK_GRAY);
		
		LOGOUTCONFIRM.setBounds(213, 350, 228, 69);
		LOGOUTCONFIRM.setVisible(false);
		MAINMENU.add(LOGOUTCONFIRM);
		LOGOUTCONFIRM.setLayout(null);
		
		JButton btnNewButton_2 = new JButton("Yes");
		btnNewButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CardLayout cl = (CardLayout)(getContentPane().getLayout());
		        cl.first(getContentPane());
		        LOGOUTCONFIRM.setVisible(false);
			}
		});
		btnNewButton_2.setBounds(56, 35, 55, 28);
		LOGOUTCONFIRM.add(btnNewButton_2);
		
		JLabel lblAreYouSure = new JLabel("Are you sure you want to log out?");
		lblAreYouSure.setHorizontalAlignment(SwingConstants.CENTER);
		lblAreYouSure.setBounds(0, 12, 228, 16);
		lblAreYouSure.setForeground(Color.WHITE);
		LOGOUTCONFIRM.add(lblAreYouSure);
		
		JButton btnNo = new JButton("No");
		btnNo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
		        LOGOUTCONFIRM.setVisible(false);
			}
		});
		btnNo.setBounds(121, 35, 55, 28);
		LOGOUTCONFIRM.add(btnNo);
		
		Component horizontalStrut_2 = Box.createHorizontalStrut(20);
		horizontalStrut_2.setBounds(0, 57, 20, 12);
		MAINMENU.add(horizontalStrut_2);
		
		Component horizontalStrut_3 = Box.createHorizontalStrut(20);
		horizontalStrut_3.setBounds(20, 57, 20, 12);
		MAINMENU.add(horizontalStrut_3);
		
		JLabel label_5 = new JLabel("");
		label_5.setBounds(80, 7, 539, 100);
		label_5.setIcon(new ImageIcon(GUI.class.getResource("/images/mainmenu_title.jpg")));
		MAINMENU.add(label_5);
		
		JButton btnJoin = new JButton("Join Game");
		btnJoin.setBounds(193, 170, 268, 28);
		btnJoin.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		btnJoin.setVisible(false);
		
		Component horizontalStrut = Box.createHorizontalStrut(20);
		horizontalStrut.setBounds(0, 166, 20, 12);
		MAINMENU.add(horizontalStrut);
		
		Component horizontalStrut_5 = Box.createHorizontalStrut(20);
		horizontalStrut_5.setBounds(20, 166, 20, 12);
		MAINMENU.add(horizontalStrut_5);
		
		Component horizontalStrut_6 = Box.createHorizontalStrut(20);
		horizontalStrut_6.setBounds(40, 166, 40, 12);
		MAINMENU.add(horizontalStrut_6);
		
		Component horizontalStrut_7 = Box.createHorizontalStrut(20);
		horizontalStrut_7.setBounds(80, 166, 20, 12);
		MAINMENU.add(horizontalStrut_7);
		
		Component horizontalStrut_8 = Box.createHorizontalStrut(20);
		horizontalStrut_8.setBounds(100, 166, 20, 12);
		MAINMENU.add(horizontalStrut_8);
		
		Component horizontalStrut_9 = Box.createHorizontalStrut(20);
		horizontalStrut_9.setBounds(120, 166, 20, 12);
		MAINMENU.add(horizontalStrut_9);
		
		Component horizontalStrut_10 = Box.createHorizontalStrut(20);
		horizontalStrut_10.setBounds(140, 166, 33, 12);
		MAINMENU.add(horizontalStrut_10);
		
		Component horizontalStrut_11 = Box.createHorizontalStrut(20);
		horizontalStrut_11.setBounds(173, 166, 20, 12);
		MAINMENU.add(horizontalStrut_11);
		MAINMENU.add(btnJoin);
		
		Component horizontalStrut_1 = Box.createHorizontalStrut(20);
		horizontalStrut_1.setBounds(0, 219, 20, 12);
		MAINMENU.add(horizontalStrut_1);
		
		JButton btnCreateGame = new JButton("Create Game");
		btnCreateGame.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		btnCreateGame.setBounds(193, 205, 268, 28);
		btnCreateGame.setVisible(false);
		MAINMENU.add(btnCreateGame);
		
		JButton btnNewButton_1 = new JButton("Statistics");
		btnNewButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CardLayout cl = (CardLayout)(getContentPane().getLayout());
		        cl.next(getContentPane());
			}
		});
		btnNewButton_1.setBounds(193, 240, 268, 28);
		MAINMENU.add(btnNewButton_1);
		
		JButton btnSettings = new JButton("Settings");
		btnSettings.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CardLayout cl = (CardLayout)(getContentPane().getLayout());
		        cl.next(getContentPane());
		        cl.next(getContentPane());
			}
		});
		btnSettings.setBounds(193, 275, 268, 28);
		btnSettings.setVisible(false);
		MAINMENU.add(btnSettings);
		
		JButton btnLogout = new JButton("Logout");
		btnLogout.setBounds(193, 310, 268, 28);
		btnLogout.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				LOGOUTCONFIRM.setVisible(true);
			}
		});
		btnSettings.setVisible(false);
		MAINMENU.add(btnLogout);
		
		JScrollPane lobbyScrollPane = new JScrollPane();
		lobbyScrollPane.setBounds(200, 137, 276, 201);
		MAINMENU.add(lobbyScrollPane);		

		sr = new ServerRemote();
		ids = sr.getTableIDs();
		numTables = 10;	
		
		//if(tableIDs.length == 0) { numTables = 10; }		
		//else { 		numTables = tableIDs.length; }
		
		tableIDs = ids.toArray(new String[numTables]);
		

		listModel = new DefaultListModel();
		JList tableList = new JList(listModel); 			
		
		lobbyScrollPane.setRowHeaderView(tableList);
		tableList.setForeground(Color.BLACK);
		
		JButton btnRefreshList = new JButton("Refresh List");
		
		btnRefreshList.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(int i=0; i<numTables; i++) {
					listModel.addElement("Table " + tableIDs[i] + "   |   Free Slots: " /*+ sr.getTableFreeSlots(i)*/ );
				}	
			}
		});
		btnRefreshList.setBounds(269, 104, 146, 26);
		MAINMENU.add(btnRefreshList);	
		
		
		JPanel STATS = new JPanel();
		STATS.setBackground(Color.BLACK);
		getContentPane().add(STATS, "name_773741260127683");
		STATS.setLayout(null);
		
		JLabel lblNewLabel_2 = new JLabel("(to be implemented once database is completed)");
		lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel_2.setForeground(Color.WHITE);
		lblNewLabel_2.setBounds(0, 152, 629, 16);
		STATS.add(lblNewLabel_2);
		
		JLabel lblNewLabel_3 = new JLabel("");
		lblNewLabel_3.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel_3.setIcon(new ImageIcon(GUI.class.getResource("/images/stats_title.jpg")));
		lblNewLabel_3.setBounds(0, 0, 629, 89);
		STATS.add(lblNewLabel_3);
		
		JButton btnReturnToMain = new JButton("Return to Main Menu");
		btnReturnToMain.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CardLayout cl = (CardLayout)(getContentPane().getLayout());
		        cl.previous(getContentPane());
			}
		});
		btnReturnToMain.setBounds(239, 376, 152, 28);
		STATS.add(btnReturnToMain);
		
		JPanel SETTINGS = new JPanel();
		SETTINGS.setBackground(Color.BLACK);
		getContentPane().add(SETTINGS, "name_774204026396720");
		SETTINGS.setLayout(null);
		
		JLabel lblNewLabel_4 = new JLabel("");
		lblNewLabel_4.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel_4.setBounds(0, 0, 629, 105);
		lblNewLabel_4.setIcon(new ImageIcon(GUI.class.getResource("/images/settings_title.jpg")));
		SETTINGS.add(lblNewLabel_4);
		
		
		final JPanel INFO = new JPanel();
		INFO.setBackground(Color.DARK_GRAY);
		INFO.setBounds(187, 226, 265, 213);
		INFO.setVisible(false);
		SETTINGS.add(INFO);
		INFO.setLayout(null);
		
		final JPanel PASSWORD = new JPanel();
		PASSWORD.setBackground(Color.DARK_GRAY);
		PASSWORD.setBounds(187, 226, 265, 116);
		PASSWORD.setVisible(false);
		
		final JPanel USERNAME = new JPanel();
		USERNAME.setBackground(Color.DARK_GRAY);
		USERNAME.setBounds(187, 226, 265, 116);
		USERNAME.setVisible(false);
		SETTINGS.add(USERNAME);
		USERNAME.setLayout(null);
		
		JLabel lblCurrentUsername = new JLabel("Current Username:");
		lblCurrentUsername.setBounds(6, 15, 115, 16);
		lblCurrentUsername.setForeground(Color.WHITE);
		USERNAME.add(lblCurrentUsername);
		
		JLabel lblNewUsername = new JLabel("New Username:");
		lblNewUsername.setHorizontalAlignment(SwingConstants.LEFT);
		lblNewUsername.setForeground(Color.WHITE);
		lblNewUsername.setBounds(6, 49, 106, 16);
		USERNAME.add(lblNewUsername);
		
		textField_5 = new JTextField();
		textField_5.setBounds(124, 43, 135, 28);
		USERNAME.add(textField_5);
		textField_5.setColumns(10);
		
		JButton btnConfirm = new JButton("Confirm");
		btnConfirm.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				INFO.setVisible(false);
				PASSWORD.setVisible(false);
				USERNAME.setVisible(false);
			}
		});
		btnConfirm.setBounds(35, 82, 90, 28);
		USERNAME.add(btnConfirm);
		
		JButton button_2 = new JButton("Cancel");
		button_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				USERNAME.setVisible(false);
				PASSWORD.setVisible(false);
				INFO.setVisible(false);
			}
		});
		button_2.setBounds(142, 82, 90, 28);
		USERNAME.add(button_2);
		SETTINGS.add(PASSWORD);
		PASSWORD.setLayout(null);
		
		JLabel lblCurrentPassword = new JLabel("Current Password:");
		lblCurrentPassword.setForeground(Color.WHITE);
		lblCurrentPassword.setBounds(6, 15, 115, 16);
		PASSWORD.add(lblCurrentPassword);
		
		JLabel lblNewPassword = new JLabel("New Password:");
		lblNewPassword.setHorizontalAlignment(SwingConstants.LEFT);
		lblNewPassword.setForeground(Color.WHITE);
		lblNewPassword.setBounds(6, 52, 106, 16);
		PASSWORD.add(lblNewPassword);
		
		
		
		

		JButton button_1 = new JButton("Confirm");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				INFO.setVisible(false);
				PASSWORD.setVisible(false);
				USERNAME.setVisible(false);
			}
		});
		button_1.setBounds(36, 82, 90, 28);
		PASSWORD.add(button_1);
		
		JButton btnCancel_1 = new JButton("Cancel");
		btnCancel_1.setBounds(146, 82, 90, 28);
		PASSWORD.add(btnCancel_1);
		
		passwordField_2 = new JPasswordField();
		passwordField_2.setBounds(117, 9, 142, 28);
		PASSWORD.add(passwordField_2);
		
		passwordField_3 = new JPasswordField();
		passwordField_3.setBounds(117, 46, 142, 28);
		PASSWORD.add(passwordField_3);
		btnCancel_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				PASSWORD.setVisible(false);
				USERNAME.setVisible(false);
				INFO.setVisible(false);
			}
		});
		
		JButton btnEditPersonalInfo = new JButton("Edit Personal Info");
		btnEditPersonalInfo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				INFO.setVisible(true);
				USERNAME.setVisible(false);
				PASSWORD.setVisible(false);
			}
		});
		btnEditPersonalInfo.setBounds(221, 186, 192, 28);
		SETTINGS.add(btnEditPersonalInfo);
		
		JLabel lblFirstName_1 = new JLabel("First Name:");
		lblFirstName_1.setBounds(10, 10, 146, 16);
		lblFirstName_1.setForeground(Color.WHITE);
		INFO.add(lblFirstName_1);
		
		JLabel lblLastName_1 = new JLabel("Last Name:");
		lblLastName_1.setForeground(Color.WHITE);
		lblLastName_1.setBounds(10, 45, 146, 16);
		INFO.add(lblLastName_1);
		
		JLabel lblAge_1 = new JLabel("Age:");
		lblAge_1.setForeground(Color.WHITE);
		lblAge_1.setBounds(10, 80, 146, 16);
		INFO.add(lblAge_1);
		
		JLabel lblGender_1 = new JLabel("Gender:");
		lblGender_1.setForeground(Color.WHITE);
		lblGender_1.setBounds(10, 115, 146, 16);
		INFO.add(lblGender_1);
		
		JLabel lblLocation_1 = new JLabel("Location:");
		lblLocation_1.setForeground(Color.WHITE);
		lblLocation_1.setBounds(10, 150, 146, 16);
		INFO.add(lblLocation_1);
		
		textField_9 = new JTextField();
		textField_9.setBounds(95, 8, 158, 20);
		INFO.add(textField_9);
		textField_9.setColumns(10);
		
		textField_10 = new JTextField();
		textField_10.setColumns(10);
		textField_10.setBounds(95, 43, 158, 20);
		INFO.add(textField_10);
		
		textField_11 = new JTextField();
		textField_11.setColumns(10);
		textField_11.setBounds(95, 78, 158, 20);
		INFO.add(textField_11);
		
		textField_12 = new JTextField();
		textField_12.setColumns(10);
		textField_12.setBounds(95, 113, 158, 20);
		INFO.add(textField_12);
		
		textField_13 = new JTextField();
		textField_13.setColumns(10);
		textField_13.setBounds(95, 148, 158, 20);
		INFO.add(textField_13);
		
		JButton button_3 = new JButton("Confirm");
		button_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				INFO.setVisible(false);
				PASSWORD.setVisible(false);
				USERNAME.setVisible(false);
			}
		});
		button_3.setBounds(33, 178, 90, 28);
		INFO.add(button_3);
		
		JButton btnCancel_2 = new JButton("Cancel");
		btnCancel_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				INFO.setVisible(false);
				PASSWORD.setVisible(false);
				USERNAME.setVisible(false);
			}
		});
		btnCancel_2.setBounds(137, 178, 90, 28);
		INFO.add(btnCancel_2);
		
		JButton btnChangeUsername = new JButton("Edit Username");
		btnChangeUsername.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				USERNAME.setVisible(true);
				PASSWORD.setVisible(false);
				INFO.setVisible(false);
				
			}
		});
		btnChangeUsername.setBounds(221, 116, 192, 28);
		SETTINGS.add(btnChangeUsername);
		
		JButton btnChangePassword = new JButton("Edit Password");
		btnChangePassword.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				PASSWORD.setVisible(true);
				USERNAME.setVisible(false);
				INFO.setVisible(false);
			}
		});
		btnChangePassword.setBounds(221, 151, 192, 28);
		SETTINGS.add(btnChangePassword);
		
		JButton btnReturnToMain_1 = new JButton("Return to Main Menu");
		btnReturnToMain_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CardLayout cl = (CardLayout)(getContentPane().getLayout());
		        cl.previous(getContentPane());
		        cl.previous(getContentPane());
		        INFO.setVisible(false);
		        PASSWORD.setVisible(false);
		        USERNAME.setVisible(false);
			}
		});
		btnReturnToMain_1.setBounds(221, 451, 192, 28);
		SETTINGS.add(btnReturnToMain_1);
		getContentPane().setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{REGISTRATION, lblNewLabel_1, lblFirstName, textField_1, LOGIN, lblNewLabel, lblUsername, textField, lblPassword, passwordField, btnNewButton, btnRegister}));
		btnRegister.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				CardLayout cl = (CardLayout)(getContentPane().getLayout());
		        cl.next(getContentPane());
			}
		});
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 645, 527);
	}
}
